package top.buyibuyi.course.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import top.buyibuyi.course.R;
import top.buyibuyi.course.service.OssService;

/*@Api(description="阿里云文件管理")*/
@RestController
@CrossOrigin
@RequestMapping("/fileoss")
public class OssController {

    @Autowired
    private OssService ossService;

    /*@ApiOperation(value = "文件上传")*/
    @PostMapping("/uploadOssfile")
    public R uploadOssfile(/*@ApiParam(name = "file", value = "文件", required = true)
                               @RequestParam("file")*/ MultipartFile file){

        String url = ossService.uploadFile(file);
        return R.ok().data("url",url);
    }
}
